STEP 9: Now we can use the value stored in head_image to display the head of our mixed-up character!

  • In GRAPHICS, from drag a Sprite at Position to the bottom of your program.
  • Change the variable name from sprite to head.
  • Change the image label from "codester" to head_image.
  • Change the y-coordinate to 83. Notice that you get a different head every time you Run your program!

To navigate the page using the TAB key, first press ESC to exit the code editor.

######################################################################## # PLACE LIST CREATIONS HERE # ######################################################################## stage_list = ["moon", "mars", "jupiter", "pluto", "space", "city"] head_list = ["head1", "head2", "head3", "head4", "head5", "head6"] ######################################################################## # PLACE ALL OTHER CODE BELOW THIS # ######################################################################## stage_image = stage_list[1] stage.set_background(stage_image) random_head = random.randint(0, 5) head_image = head_list[random_head]
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)